home *** CD-ROM | disk | FTP | other *** search
- Path: keats.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: Keyboard buffer problems...please help!
- Date: 22 Feb 1996 11:48:22 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4giha6INN9pg@keats.ugrad.cs.ubc.ca>
- References: <3126B507.4052@canna.ucsd.edu>
- NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
-
- In article <3126B507.4052@canna.ucsd.edu>,
- Eric C. Liebl <ecl@canna.ucsd.edu> wrote:
- >I am looking for a C command that will flush the keyboard buffer before
- >it is read. I am using Borland C/C++ 4.0 to compile my program.
-
- This question crops up about three times a week. It is definitely addressed in
- the FAQ.
-
- The C language has no concepts of keyboards, screens or any such thing. There
- is no way to clear the keyboard buffer, since this is maintained either by
- hardware, or by some sort of operating system terminal or console driver.
-
- >when an appropriate key is hit I update graphics, etc. in my
- >program. However, if a user holds the key down the key data fills the
- >keyboard buffer and I get an annoying beep and too many "moves" get
- >stored up in advance.
-
- If you are doing graphics, you might as well deviate from standard C library
- functions in your handling of user input. Your graphics API surely includes
- ways to get unbuffered keyboard and mouse input?
-
- For example, if you were using the X11 library to communicate with an X
- display, you would receive detailed events regarding keys being pressed and
- released in a particular window.
-
- Read the FAQ and the information that comes with your programming environment.
- --
-
-